import cgi
import os

os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
from google.appengine.dist import use_library
use_library('django', '1.1')

from django.utils import simplejson
from google.appengine.ext import webapp

class GetInstanceTierHandler(webapp.RequestHandler):
  def post(self, instance):
    #TODO: Placeholder response
    
    response = {}
    
    # Only thing in the post data object we care about is the command ID.
    response["commandID"] = simplejson.loads( self.request.get("data") )["commandID"]
    
    # Placeholder response
    response["tier"] = self.instanceTier(instance)
    
    self.response.headers["Content-Type"] = "text/plain"
    self.response.out.write( simplejson.dumps(response) )
    
  # Separate this functionality from the handler so it can be called by itself.
  def instanceTier(instance):
    #TODO: Placeholder response
    return "10.0"